package cn.good.yan.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * 订单实体
 *
 * @author shengren.yan
 * @create 2024-02-22
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "t_order")
public class Order {

    @TableId(value = "id", type = IdType.INPUT)
    private Long id;

    /**
     * 用户id
     */
    @TableField(value = "user_id")
    private Long userId;

    /**
     * 产品id
     */
    @TableField(value = "product_id")
    private Long productId;

    /**
     * 数量
     */
    @TableField(value = "`count`")
    private Integer count;

    /**
     * 金额
     */
    @TableField(value = "money")
    private BigDecimal money;

    /**
     * 订单状态：0：创建中；1：已完结
     */
    @TableField(value = "`status`")
    private Integer status;

}

//    CREATE DATABASE seata_order;
//
//    CREATE TABLE t_order (
//    `id` BIGINT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
//    `user_id` BIGINT(11) DEFAULT NULL COMMENT '用户id',
//    `product_id` BIGINT(11) DEFAULT NULL COMMENT '产品id',
//    `count` INT(11) DEFAULT NULL COMMENT '数量',
//    `money` DECIMAL(11,0) DEFAULT NULL COMMENT '金额',
//    `status` INT(1) DEFAULT NULL COMMENT '订单状态：0：创建中；1：已完结'
//    ) ENGINE=INNODB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;


